using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Blople.GameComponents;


namespace Blople.ManagerClasses
{
    public class BlopManager : Microsoft.Xna.Framework.DrawableGameComponent
    {
        protected List<Blop> blops = new List<Blop>();
        protected Texture2D texture;

        public BlopManager(Game game, Texture2D texture) : base(game)
        {
            this.texture = texture;
        }

        public override void Initialize()
        {
            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            for (int i = 0; i < blops.Count; i++)
            {
                blops[i].Update(gameTime);
            }

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            for (int i = 0; i < blops.Count; i++)
            {
                blops[i].Draw(gameTime);
            }
        }

        public Blop CreateBlop(int level)
        {
            Blop blop = new Blop(Game, texture, level);
            blops.Add(blop);
            return blop;
        }

        public void DestroyBlop(Blop blop)
        {
            blops.Remove(blop);
        }

        public List<Blop> Blops
        {
            get { return blops; }
            set { blops = value; }
        }
    }
}
